package com.stone.design.patterns.observer.javaObserver;

import java.util.Observable;

/**
 * @author Stone
 * @version V1.0
 * @description: 继承java自带的主题。可观察者
 * @date 4/19/18 22:16
 * @email redsstone@163.com
 */
public class WeatherData extends Observable{

    private float temperature;
    private float humidity;
    private float pressure;

    public WeatherData() {}

    public void setMeasurements(float temperature, float humidity, float pressure){
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        measurementsChanged();

    }

    public void measurementsChanged() {
        setChanged();
        notifyObservers();
    }

    public float getTemperature() {
        return temperature;
    }

    public float getHumidity() {
        return humidity;
    }

    public float getPressure() {
        return pressure;
    }
}
